<%@page pageEncoding="UTF-8" contentType="text/html;charset=utf-8" errorPage="/commons/error.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='zh-CN' xml:lang='zh-CN' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>用户管理</title>
<style type="text/css">
table{font-size: 12px;}
</style>
</head>
<body>
<form:form id="form" class="form-inline" commandName="userQuery" action="${ctx}/admin/user/list" method="post">
<div class="form-group">
	<label for="user_name">用户名</label>
	<form:input path="user_name" id="user_name" class="form-control width-140" placeholder="用户名" />
</div>
<div class="form-group">
	<label for="phone">手机</label>
	<form:input path="phone" id="phone" class="form-control width-140" placeholder="手机" />
</div>
<div class="checkbox">
	<label></label>
		<label><form:checkbox path="active"/>激活</label>
</div>
<div class="form-group">
	<button type="submit" class="btn btn-primary">查询</button>
</div>
<table class="table table-striped">
	<thead>
		<tr>
			<th>ID</th>
			<th>用户名</th>
			<th>手机号</th>
		    <th>激活</th>
		    <th>注册时间</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="item" items="${page.result}">
		<tr>
			<td><a href="${ctx}/admin/user/detail/${item.id}">${item.id}</a></td>
			<td>${item.user_name}</td>
			<td>${item.phone}</td>
			<td><input type="checkbox" <c:if test="${item.active}">checked="checked"</c:if> disabled="disabled"/></td>
			<td><fmt:formatDate value="${item.register_time}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
		</tr>
		</c:forEach>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="4">
				<jsp:include page="/commons/pager.jsp" />
			</td>
		</tr>
	</tfoot>
</table>
</form:form>
<script type="text/javascript" src="${ctx}/scripts/lottery.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#nav_user").addClass("active");
	})
	
</script>
</body>
</html>